Repository navigation
fix: pass the wheel to programs that report the mouse - #61
Merged
LukeGus merged 1 commit intoNov 7, 2026
Merged
Conversation
|
AI review | Looks safe to merge The PR fixes terminal wheel scrolling behavior when mouse reporting is enabled by passing the mouse tracking mode to the scroll check. The changes are safe, focused, and include appropriate tests. No issues found. Reviewed 1c67981. AI can be wrong, a maintainer still decides. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The custom wheel handler drops a plain wheel on a normal buffer with no scrollback yet (
wheelHasNothingToScroll), so it does not turn into arrow keys that walk shell history. It does that even when the program has mouse reporting on. In that case xterm would send the wheel to the program as a mouse report, not as arrow keys, so nothing needs dropping, and the program never gets the wheel.I hit this with tmux (
mouse on) attached through agent-deck. Switching sessions leaves the alternate screen, clears the scrollback (CSI 3 J) and attaches tmux on the normal screen with?1000h ?1002h ?1006h. The buffer is thennormal,baseY0 andmouseTrackingModedrag, and the wheel does nothing in tmux or in the app inside it. Any resize brings it back, because the reflow pushes lines into the scrollback (baseY> 0) and the check stops matching. So it looks random: scrolling dies after a session switch and returns when the sidebar opens or the window is resized.This makes
wheelHasNothingToScrolltaketerminal.modes.mouseTrackingModeand only drop the wheel when it is"none". Without mouse reporting nothing changes.Changes
terminal-wheel.ts:wheelHasNothingToScroll(buffer, mouseTrackingMode)returns true only when mouse tracking is off.Terminal.tsx: the wheel handler passesterminal.modes.mouseTrackingMode.x10,vt200,dragandany. The existing cases pass"none".Reproduce without tmux
A program that clears the screen and scrollback, turns on mouse reporting on the normal screen and logs what it reads:
Before: the wheel prints nothing. After: each notch prints an SGR wheel report (
^[[<64;...M). Ctrl+C, thenreset. This is the same sequence the program in my browser test sent; I did not run this exact one-liner.Testing
npm test: 628 passed (79 files).tsc -p .,prettier --checkon the changed files andnpm run buildare clean. The new test case fails without the change.